package com.objectproject.main.service.system;

import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.objectproject.main.dao.MyLocaleDAOImpl;
import com.objectproject.main.model.MyLocale;

@Service
public class MyLocaleResolver {
	
	
	@Autowired
	MyLocaleDAOImpl myLocaleDAOImpl;
	
	
	public MyLocale getMyLocaleFrom(int localeId){
		return myLocaleDAOImpl.getMyLocaleById(localeId);
	}
	
	public MyLocale getMyLocaleFrom(Locale locale){
		return myLocaleDAOImpl.getMyLocaleByString(locale.toString());
	}
	
	
	public Locale getLocaleFrom(MyLocale myLocale){
		return null;
	}
	
	public boolean isAvailableLocale(Locale locale){
		
		if( myLocaleDAOImpl.getMyLocaleByString(locale.toString()) != null){
			return true;
		}
		return false;
		
	}
	
	public boolean isAvailableLocaleFromString(String localeString){
		
		if( myLocaleDAOImpl.getMyLocaleByString(localeString) != null){
			return true;
		}
		return false;
		
	}
	
	public boolean isAvailableMyLocale(MyLocale myLocale){
		
		if( myLocaleDAOImpl.getMyLocaleByString(myLocale.toString()) != null){
			return true;
		}
		return false;
		
	}
	
	public boolean isAvailableMyLocaleFromString(String myLocaleString){
		
		if( myLocaleDAOImpl.getMyLocaleByString(myLocaleString) != null){
			return true;
		}
		return false;
		
	}
}
